const rules = {
  schoolId: [
    { required: true, message: '学校名称不能为空', trigger: 'change' }
  ],
  agencyName: [
    { required: true, message: '机构名称不能为空', trigger: 'change' }
  ],
  areaId: [
    { required: true, message: '所属区域不能为空', trigger: 'change' }
  ],
  type: [
    { required: true, message: '机构类型不能为空', trigger: 'change' }
  ],
  description: [
    { required: false, message: '机构简介不能为空', trigger: 'change' }
  ],
  schoolName: [
    { required: true, message: '学校名称不能为空', trigger: 'change' }
  ],
  tagIds: [
    { required: true, message: '标签不能为空', trigger: 'change' }
  ],
  recommend:[
    { required: true, message: '推荐不能为空', trigger: 'change' }
  ]
}

const params = {
  agencyId: '',
  agencyName: '',
  areaId: [],
  description: '',
  schoolId: '',
  schoolName: '',
  type: '',
  tagIds: [],
  recommend: '0'
}

export function transOptionsItem(array, compare) {
  return array.filter(compare)[0] || { value: '', label: '' }
}

export function isAgency(type) {
  return type === '1'
}

export {
  rules,
  params
}
